%% nfssext-cfr.sty
%% Additions and changes are copyright 2008 Clea F. Rees
%% Code from nfssext.sty copyright 2003 Philipp Lehman (see below)
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Clea F. Rees.
%
% This work consists of the file nfssext-cfr.sty.
%
% The file nfssext-cfr.sty is a derived work under the terms of the 
% LPPL. It is based on version 1.2 of nfssext.sty which is part of The 
% Font Installation Guide by Philipp Lehman. A copy of the The Font 
% Installation Guide, including the unmodified version of nfssext.sty 
% is available from 
% http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=fontinstallationguide.
% nfssext.sty is part of the included archive figuide-examples.tar.gz
% which consists of examples and templates released under the LPPL.
% nfssext.sty is included in the files for tutorials 3, 5 and 6.
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nfssext-cfr}[2008/11/08 specially mangled by cfr; based on 2003/03/14 v1.2 Experimental NFSS Extensions]
%:cfr-added
\RequirePackage{ifthen}
%:end-added
\newcommand*{\exfs@tempa}{}
\newcommand*{\exfs@tempb}{}
%:cfr-added
\newcommand*{\exfs@tempf}{}
%:end-added
\newcommand*{\exfs@try@family}[2][]{%
  \let\exfs@tempa\relax
  \begingroup
    \fontfamily{#2}\try@load@fontshape
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
      \edef\exfs@tempa{#1}%
      \ifx\exfs@tempa\@empty
        \PackageWarning{nfssext}{%
          Font family '\f@encoding/#2' not available\MessageBreak
          Ignoring font switch}%
      \else
        \PackageInfo{nfssext}{%
          Font family '\f@encoding/#2' not available\MessageBreak
          Font family '\f@encoding/#1' tried instead}%
        \exfs@try@family{#1}%
      \fi
    \else
      \gdef\exfs@tempa{\fontfamily{#2}\selectfont}%
    \fi
  \endgroup
  \exfs@tempa}
%:cfr-added exfs@try@series
\newcommand*{\exfs@try@series}[2][]{%
  \let\exfs@tempa\relax
  \begingroup
    \fontseries{#2}\try@load@fontshape
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
      \edef\exfs@tempa{#1}%
      \ifx\exfs@tempa\@empty
        \PackageWarning{nfssext-cfr}{%
          Font series '\f@encoding/\f@family/#2' not available\MessageBreak
          Ignoring font switch}%
      \else
        \PackageInfo{nfssext-cfr}{%
          Font family '\f@encoding/\f@family/#2' not available\MessageBreak
          Font family '\f@encoding/\f@family/#1' tried instead}%
        \exfs@try@series{#1}%
      \fi
    \else
      \gdef\exfs@tempa{\fontseries{#2}\selectfont}%
    \fi
  \endgroup
  \exfs@tempa}
%:end-added
\def\exfs@get@base#1#2#3#4\@nil{#1#2#3}
%:cfr-added
\def\exfs@get@variants#1#2#3#4\@nil{#4}
\def\exfs@next#1#2\@nil{#1}
\def\exfs@shift#1#2\@nil{#2}
\def\exfs@first#1#2\@nil{#1}
\def\exfs@part#1#2\@nil{#2}
\def\exfs@second#1#2#3\@nil{#2}
%:end-added
\DeclareRobustCommand{\lnstyle}{%
  \not@math@alphabet\lnstyle\relax
  \exfs@try@family[\expandafter\exfs@get@base\f@family\@nil]%
                  {\expandafter\exfs@get@base\f@family\@nil x}}
\DeclareRobustCommand{\osstyle}{%
  \not@math@alphabet\osstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil j}}
\DeclareRobustCommand{\instyle}{%
  \not@math@alphabet\instyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 0}}
\DeclareRobustCommand{\sustyle}{%
  \not@math@alphabet\sustyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 1}}
\DeclareRobustCommand{\swstyle}{%
  \not@math@alphabet\swstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil w}}
%:cfr-added - merge families
\newcommand*\exfs@merge@families[1]{%
	\edef\exfs@tempf{#1}%
	\edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
	\edef\tempo{2j}%
	\let\exfs@tempq\@empty
	\def\exfs@tempg{}%
	\newif\ifadded
		\addedfalse
	% check whether there are variants - if not just use the requested addition
	\ifx\tempa\@empty
		\edef\exfs@tempq{\exfs@tempf}%
		\addedtrue
	\else
		\gdef\set{0,1,2,a,d,e,f,h,j,l,p,q,s,t,v,w}%
		\ifx\tempo\exfs@tempf
			\@for \xx:=\set \do {%
				% check whether there are variants left - if not set the ``next variant'' to empty 
				\ifx\tempa\@empty
					\let\exfs@tempn\@empty
				\else
					% o/w get the next variant
					\edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
				\fi
				\edef\tempt{2}%
				\edef\tempj{j}%
				% if the next variant is 2 or j, ignore it
				\ifx\exfs@tempn\tempt
					\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\fi
				\ifx\exfs@tempn\tempj	% if the next variant is j, ignore it
						\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\fi
				% see if the current value is either 2 or j and add it if so and if needed
				\ifx\tempt\xx
					\edef\exfs@tempg{\exfs@tempg\xx}%
				\else
					\ifx\tempj\xx	% if the current value is j, we're done
						\edef\exfs@tempq{\exfs@tempg\xx\tempa}%
						\let\tempa\@empty
						\addedtrue
					\else
						% o/w see if the current value matches the next variant
						\ifx\xx\exfs@tempn
							\edef\exfs@tempg{\exfs@tempg\xx}%
							\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
						\fi
					\fi
				\fi
			}%
		\else
			\@for \xx:=\set \do {%
				% check whether there are variants left and, if not, add the addition if needed
				\ifx\tempa\@empty
					\ifadded
					\else
						\edef\exfs@tempq{\exfs@tempg\exfs@tempf}%
						\addedtrue
					\fi
				\else
					% o/w get the next variant
					\edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
						% if the new token equals the next variant, combine whatever is saved in \exfs@tempg with whatever remains in \tempa
					\ifx\exfs@tempn\exfs@tempf
						\edef\exfs@tempq{\exfs@tempg\tempa}%
						\addedtrue
						\let\tempa\@empty
					\else
						% o/w, if the current value matches the requested addition, add it in
						\ifx\exfs@tempf\xx
							\edef\exfs@tempq{\exfs@tempg\xx\tempa}%
							\addedtrue
							\let\tempa\@empty
						\else
							% o/w, if the current value matches the next variant, shift
							\ifx\exfs@tempn\xx
								\edef\exfs@tempg{\exfs@tempg\xx}%
								\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
							\fi
						\fi
					\fi
				\fi	
			}%
		\fi
	\fi
	\ifx\exfs@tempq\@empty
		\PackageError{nfssext-cfr}{Something is wrong here. Ignoring font switching command.}{}%
	\else
	\exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
	\fi}
\DeclareRobustCommand{\pstyle}{%		proportional figures
	\not@math@alphabet\pstyle\relax
	\exfs@merge@families{2}}
\DeclareRobustCommand{\tistyle}{%	titling/display
	\not@math@alphabet\tistyle\relax
	\exfs@merge@families{d}}
\DeclareRobustCommand{\ostyle}{%		oldstyle figures (cf. original osstyle above)
	\not@math@alphabet\ostyle\relax
	\exfs@merge@families{j}}
% combined command for proportional oldstyle
\DeclareRobustCommand{\postyle}{%
	\not@math@alphabet\postyle\relax
	\exfs@merge@families{2j}}
%note that this command is for use when the light version is a separate family rather than a weight variant (e.g. when you've got light, light bold etc. as well as regular weights)
\DeclareRobustCommand{\ltstyle}{%
	\not@math@alphabet\ltstyle\relax
	\exfs@merge@families{l}}
\DeclareRobustCommand{\altstyle}{%	alternative style
	\not@math@alphabet\altstyle\relax
	\exfs@merge@families{a}}
\DeclareRobustCommand{\regstyle}{% ``regular'' style
  \not@math@alphabet\regstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil}}
\DeclareRobustCommand{\embossstyle}{%
	\not@math@alphabet\embossstyle\relax
	\exfs@merge@families{e}}
\DeclareRobustCommand{\ornamentalstyle}{%	intended primarily for decorative initial fonts etc.
	\not@math@alphabet\ornamentalstyle\relax
	\exfs@merge@families{p}}
\DeclareRobustCommand{\qtstyle}{%	quotation style (assumes sans)
	\not@math@alphabet\qtstyle\relax
	\sffamily
	\exfs@merge@families{q}}
\DeclareRobustCommand{\shstyle}{%
	\not@math@alphabet\shstyle\relax
	\exfs@merge@families{h}}
\DeclareRobustCommand{\swashstyle}{%			an attempt to improve on \swstyle
	\not@math@alphabet\swashstyle\relax
	\exfs@merge@families{w}}
\DeclareRobustCommand{\tmstyle}{%	monowidth typewriter
	\not@math@alphabet\tmstyle\relax
	\exfs@merge@families{t}}
\DeclareRobustCommand{\tvstyle}{%	variable width typewriter
	\not@math@alphabet\tvstyle\relax
	\exfs@merge@families{v}}
%:cfr-added - unmerge families
\newcounter{taken}%
\newcommand*\exfs@unmerge@families[1]{%
	\edef\exfs@tempf{#1}%
	\edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
	\let\exfs@tempq\@empty
	\edef\exfs@tempg{}%
	\setcounter{taken}{0}%
	% check whether there are variants - if not do nothing
	\ifx\tempa\@empty
		\edef\exfs@tempq{}%
	\else
		% o/w go through the variants to find the one to delete
		\whiledo{\value{taken}<1}{%
			% get the next variant
			\edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
			% see if the next variant is the thing we seek and, if so, eliminate it
			\ifx\exfs@tempf\exfs@tempn
				\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\edef\exfs@tempq{\exfs@tempg\tempa}%
				\stepcounter{taken}%
			% o/w save the next variant and move on if any variants remain
			\else
				\edef\exfs@tempg{\exfs@tempg\exfs@tempn}%
				\edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
				\ifx\tempa\@empty% if there are no variants left, we're done
					\edef\exfs@tempq{\exfs@tempg}%
					\stepcounter{taken}%
				\fi
			\fi
		}%
	\fi
	\exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}}
\DeclareRobustCommand{\tstyle}{%		tabular figures
	\not@math@alphabet\tstyle\relax
	\exfs@unmerge@families{2}}
\DeclareRobustCommand{\lstyle}{%		lining figures (cf. command above)
	\not@math@alphabet\lstyle\relax
	\exfs@unmerge@families{j}}
% make a combined command for tabular lining
\DeclareRobustCommand{\tlstyle}{%
	\lstyle\tstyle}
% proportional lining
\DeclareRobustCommand{\plstyle}{%
	\lstyle\pstyle}
% tabular oldstyle {?!}
\DeclareRobustCommand{\tostyle}{%
	\ostyle\tstyle}
%:end-added % si is italic sc
\newcommand*{\sidefault}{si}
\DeclareRobustCommand{\sishape}{%
  \not@math@alphabet\sishape\relax
  \fontshape\sidefault\selectfont}
%:cfr-added - is this how outline shapes should be handled?
\newcommand*{\oldefault}{ol}
\DeclareRobustCommand{\olshape}{%
	\not@math@alphabet\olshape\relax
	\fontshape\oldefault\selectfont}
\newcommand*{\scoldefault}{scol}
\DeclareRobustCommand{\scolshape}{%
	\not@math@alphabet\scolshape\relax
	\fontshape\scoldefault\selectfont}
%\DeclareRobustCommand{\olshape}{%
%  \not@math@alphabet\olshape\relax
%  \exfs@merge@shape{\oldefault}{\scdefault}{\scoldefault}}
%:fudge
\newcommand*{\udefault}{u}
\DeclareRobustCommand{\ushape}{%
	\not@math@alphabet\ushape\relax
	\fontshape\udefault\selectfont}
\newcommand*{\scudefault}{su}
\DeclareRobustCommand{\scushape}{%
	\not@math@alphabet\scushape\relax
	\fontshape\scudefault\selectfont}
%:upright italic
\newcommand*{\uidefault}{ui}
\DeclareRobustCommand{\uishape}{%
	\not@math@alphabet\uishape\relax
	\fontshape\uidefault\selectfont}
%:can i do this for reverse italic?
\newcommand*{\ridefault}{ri}
\DeclareRobustCommand{\rishape}{%
	\not@math@alphabet\rishape\relax
	\fontshape\ridefault\selectfont}
%:end-added
\newcommand*{\exfs@merge@shape}[3]{%
  \edef\exfs@tempa{#1}%
  \edef\exfs@tempb{#2}%
  \ifx\f@shape\exfs@tempb
    \expandafter\ifx\csname\f@encoding/\f@family/\f@series/#3\endcsname\relax
    \else
      \edef\exfs@tempa{#3}%
    \fi
  \fi
  \fontshape{\exfs@tempa}\selectfont}
%:cfr-added - merge width changes into series
\newcommand*{\exfs@font@width}{%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\ifx\exfs@temppart\@empty
		\def\exfs@width{}
	\else
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\ifx\exfs@temps{b}
			\edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
		\else
			\ifx\exfs@temps{l}
				\edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
			\else
				\edef\exfs@width{\exfs@temppart}%
			\fi
		\fi
	\fi
	\exfs@width
	}
\newcommand*{\exfs@merge@width}[1]{%
	\edef\exfs@temph{#1}%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\def\tempb{b}%
	\def\templ{l}%
	\ifx\exfs@temppart\@empty
		\def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
	\else
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\ifx\exfs@temps\tempb
			\def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
		\else
			\ifx\exfs@temps\templ
				\def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
			\else
				\def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
			\fi
		\fi
	\fi
	\exfs@try@series{\exfs@series}}
%	\fontseries\exfs@series\selectfont}
\newcommand*{\exfs@unmerge@width}{%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\def\tempb{b}%
	\def\templ{l}%
	\ifx\exfs@temppart\@empty
		\def\exfs@series{\expandafter\exfs@tempf}%
	\else
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\ifx\exfs@temps\tempb
			\def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
		\else
			\ifx\exfs@temps\templ
				\def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
			\else
				\def\exfs@series{\expandafter\exfs@tempf}%
			\fi
		\fi
	\fi
	\exfs@try@series{\exfs@series}}
\DeclareRobustCommand{\regwidth}{%
	\not@math@alphabet\regwidth\relax
	\exfs@unmerge@width}
\newcommand*{\nwdefault}{c}
\DeclareRobustCommand{\nwwidth}{%
	\not@math@alphabet\nwwidth\relax
	\exfs@merge@width{\nwdefault}}
\newcommand*{\cddefault}{c}
\DeclareRobustCommand{\cdwidth}{%
	\not@math@alphabet\cdwidth\relax
	\exfs@merge@width{\cddefault}}
\newcommand*{\ecdefault}{ec}
\DeclareRobustCommand{\ecwidth}{%
	\not@math@alphabet\ecwidth\relax
	\exfs@merge@width{\ecdefault}}
\newcommand*{\ucdefault}{uc}
\DeclareRobustCommand{\ucwidth}{%
	\not@math@alphabet\ucwidth\relax
	\exfs@merge@width{\ucdefault}}
\newcommand*{\etdefault}{x}
\DeclareRobustCommand{\etwidth}{%
	\not@math@alphabet\etwidth\relax
	\exfs@merge@width{\etdefault}}
\newcommand*{\epdefault}{x}
\DeclareRobustCommand{\epwidth}{%
	\not@math@alphabet\epwidth\relax
	\exfs@merge@width{\epdefault}}
\newcommand*{\exdefault}{ex}
\DeclareRobustCommand{\exwidth}{%
	\not@math@alphabet\exwidth\relax
	\exfs@merge@width{\exdefault}}
\newcommand*{\uxdefault}{ux}
\DeclareRobustCommand{\uxwidth}{%
	\not@math@alphabet\uxwidth\relax
	\exfs@merge@width{\uxdefault}}	
%:cfr-added merge weight changes into series
\newcommand*{\exfs@merge@weight}[1]{%
	\edef\exfs@tempg{#1}%
	\edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
	\edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
	\def\templ{l}%
	\def\tempb{b}%
	%:case when there's no second part, so the single character must be the weight and should be replaced
	\ifx\exfs@temppart\@empty
		\def\exfs@series{\expandafter\exfs@tempg}%
	%:case when there's a second part
	\else
		%:get first character of second part
		\edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
		\edef\exfs@tempw{\expandafter\exfs@part\exfs@temps\@nil }%
		%:is the first character b? if so, it is part of the weight and should be replaced
		\ifx\exfs@temps\tempb
			\def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
		\else
			%:is the first character l? if so, it is part of the weight and should be replaced
			\ifx\exfs@temps\templ
				\def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
			\else
				%:o/w the first character is part of the width and should be retained
				\def\exfs@series{\expandafter\exfs@tempg\exfs@temppart}%
			\fi
		\fi
	\fi
	%\fontseries\exfs@series\selectfont}
	\ifx\exfs@tempg\exfs@series
		\exfs@try@series{\exfs@series}%
	\else
		\exfs@try@series[\exfs@tempg]{\exfs@series}%		assume user wants to change weight even if this changes back to the default width
	\fi}
\newcommand*{\mbdefault}{mb}
\DeclareRobustCommand{\mbweight}{%
	\not@math@alphabet\mbweight\relax
	\exfs@merge@weight{\mbdefault}}
\newcommand*{\dbdefault}{db}
\DeclareRobustCommand{\dbweight}{%
	\not@math@alphabet\dbweight\relax
	\exfs@merge@weight{\dbdefault}}
\newcommand*{\sbdefault}{sb}
\DeclareRobustCommand{\sbweight}{%
	\not@math@alphabet\sbweight\relax
	\exfs@merge@weight{\sbdefault}}
\newcommand*{\ebdefault}{eb}
\DeclareRobustCommand{\ebweight}{%
	\not@math@alphabet\ebweight\relax
	\exfs@merge@weight{\ebdefault}}
\newcommand*{\ubdefault}{ub}
\DeclareRobustCommand{\ubweight}{%
	\not@math@alphabet\ubweight\relax
	\exfs@merge@weight{\ubdefault}}
\newcommand*{\lgdefault}{l}
%note - use this if light is a variant weight, rather than a separate family
\DeclareRobustCommand{\lgweight}{%
	\not@math@alphabet\lgweight\relax
	\exfs@merge@weight{\lgdefault}}
\newcommand*{\eldefault}{el}
\DeclareRobustCommand{\elweight}{%
	\not@math@alphabet\elweight\relax
	\exfs@merge@weight{\eldefault}}
\newcommand*{\uldefault}{ul}
\DeclareRobustCommand{\ulweight}{%
	\not@math@alphabet\ulweight\relax
	\exfs@merge@weight{\uldefault}}
%:end-added
\DeclareRobustCommand{\itshape}{%
  \not@math@alphabet\itshape\mathit
  \exfs@merge@shape{\itdefault}{\scdefault}{\sidefault}}
% original
%\DeclareRobustCommand{\scshape}{%
%  \not@math@alphabet\scshape\relax
%  \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}}
%:cfr-altered
\DeclareRobustCommand{\scshape}{%
  \not@math@alphabet\scshape\relax
  \def\tempu{u}%
  \def\tempo{ol}%
  \ifx\f@shape\tempu
  	\exfs@merge@shape{\scdefault}{\udefault}{\scudefault}%
  \else
  	\ifx\f@shape\tempo
		\exfs@merge@shape{\scdefault}{\oldefault}{\scoldefault}%
	\else
  		\exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}%
	\fi
  \fi}
%:end-altered
\DeclareRobustCommand{\upshape}{%
  \not@math@alphabet\upshape\relax
  \exfs@merge@shape{\updefault}{\sidefault}{\scdefault}}
\DeclareRobustCommand{\dfshape}{%
  \not@math@alphabet\dfshape\relax
  \fontshape\shapedefault\selectfont}
\newcommand*{\swshapedefault}{\itdefault}
\DeclareRobustCommand{\swshape}{%
  \not@math@alphabet\swshape\relax
  \swstyle\fontshape\swshapedefault\selectfont}
\DeclareTextFontCommand{\textln}{\lnstyle}
\DeclareTextFontCommand{\textos}{\osstyle}
\DeclareTextFontCommand{\textin}{\instyle}
\DeclareTextFontCommand{\textsu}{\sustyle}
\DeclareTextFontCommand{\textsi}{\sishape}
\DeclareTextFontCommand{\textdf}{\dfshape}
\DeclareTextFontCommand{\textsw}{\swshape}
%:cfr-added
%:families
\DeclareTextFontCommand{\textti}{\tistyle}
\DeclareTextFontCommand{\textlt}{\ltstyle}
\DeclareTextFontCommand{\textalt}{\altstyle}					% alternative style
\DeclareTextFontCommand{\textreg}{\regstyle}					% ``regular'' style
\DeclareTextFontCommand{\emboss}{\embossstyle}
\DeclareTextFontCommand{\textorn}{\ornamentalstyle}	% intended primarily for decorative initials etc.
\DeclareTextFontCommand{\textqt}{\qtstyle}
\DeclareTextFontCommand{\textsh}{\shstyle}						% shadowed style
\DeclareTextFontCommand{\texttm}{\tmstyle}
\DeclareTextFontCommand{\texttv}{\tvstyle}
%:families - figures
\DeclareTextFontCommand{\textl}{\lstyle}
\DeclareTextFontCommand{\texto}{\ostyle}
\DeclareTextFontCommand{\textp}{\pstyle}
\DeclareTextFontCommand{\textt}{\tstyle}
\DeclareTextFontCommand{\textpl}{\plstyle}
\DeclareTextFontCommand{\textpo}{\postyle}
\DeclareTextFontCommand{\texttl}{\tlstyle}
\DeclareTextFontCommand{\textto}{\tostyle}
%:shapes
\DeclareTextFontCommand{\textol}{\olshape}						% outline
\DeclareTextFontCommand{\textswash}{\swashstyle}		% an attempt to improve on \textsw
\DeclareTextFontCommand{\textu}{\ushape}
\DeclareTextFontCommand{\textscu}{\scushape}
\DeclareTextFontCommand{\textui}{\uishape}						% upright italic
\DeclareTextFontCommand{\textri}{\rishape}						% reverse italic
%:widths
\DeclareTextFontCommand{\textnw}{\nwwidth}
\DeclareTextFontCommand{\textcd}{\cdwidth}
\DeclareTextFontCommand{\textec}{\ecwidth}
\DeclareTextFontCommand{\textuc}{\ucwidth}
\DeclareTextFontCommand{\textet}{\etwidth}
\DeclareTextFontCommand{\textep}{\epwidth}
\DeclareTextFontCommand{\textex}{\exwidth}
\DeclareTextFontCommand{\textux}{\uxwidth}
\DeclareTextFontCommand{\textrw}{\regwidth}
%:weights
\DeclareTextFontCommand{\textmb}{\mbweight}
\DeclareTextFontCommand{\textdb}{\dbweight}
\DeclareTextFontCommand{\textsb}{\sbweight}
\DeclareTextFontCommand{\texteb}{\ebweight}
\DeclareTextFontCommand{\textub}{\ubweight}
\DeclareTextFontCommand{\textlg}{\lgweight}
\DeclareTextFontCommand{\textel}{\elweight}
\DeclareTextFontCommand{\textul}{\ulweight}
%end-added
\newcommand*{\DeclareTextOrnament}[7]{%
  \expandafter\def\csname#1@orn\@roman#2\endcsname{#3/#4/#5/#6/#7}}
\begingroup
  \catcode`\/=12
  \gdef\exfs@split@orndef#1/#2/#3/#4/#5\@nil{%
    \def\f@encoding{#1}%
    \def\f@family{#2}%
    \def\f@series{#3}%
    \def\f@shape{#4}%
    \def\exfs@tempa{#5}}
\endgroup
\def\exfs@base@family{\expandafter\exfs@get@base\f@family\@nil}
\DeclareRobustCommand{\ornament}[1]{%
  \expandafter\ifx\csname\exfs@base@family @orn\@roman#1\endcsname\relax
    \PackageWarning{nfssext}{%
      Ornament #1 undefined for font family '\exfs@base@family'\MessageBreak
      Setting debug mark}%
    \rule{1ex}{1ex}%
  \else
    \begingroup
      \edef\exfs@tempb{\csname\exfs@base@family @orn\@roman#1\endcsname}%
      \expandafter\expandafter\expandafter\exfs@split@orndef
        \expandafter\string\exfs@tempb\@nil
      \selectfont\char\exfs@tempa
    \endgroup
  \fi}
\endinput
